//
//  ColorView.m
//  代码完成UI布局
//
//  Created by apple on 15/9/15.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ColorView.h"

@implementation ColorView
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        CGSize size = self.frame.size;
        _aLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width * 0.25, size.height)];
        
        _aLabel.layer.cornerRadius = 5;
        
        _aLabel.layer.masksToBounds =YES;
        
        [self addSubview:_aLabel];
        
        _bLabel = [[UILabel alloc] initWithFrame:CGRectMake(size.width * 0.25, 0, size.width * 0.25, size.height)];
        
        [self addSubview:_bLabel];
        
        _cLabel = [[UILabel alloc] initWithFrame:CGRectMake(size.width * 0.5, 0, size.width * 0.25, size.height)];
        
        [self addSubview:_cLabel];
        
        _dLabel = [[UILabel alloc] initWithFrame:CGRectMake(size.width * 0.75, 0, size.width * 0.25, size.height)];
        
        _dLabel.layer.cornerRadius = 5;
        _dLabel.layer.masksToBounds = YES;
        
        [self addSubview:_dLabel];
    }
    return  self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGSize size = self.frame.size;
    
    _aLabel.frame =CGRectMake(0, 0, size.width * 0.25, size.height);
    
    _bLabel.frame =CGRectMake (size.width * 0.25, 0, size.width * 0.25, size.height);
    
    _cLabel.frame = CGRectMake(size.width * 0.5, 0, size.width * 0.25, size.height);
    
    _dLabel.frame =CGRectMake(size.width * 0.75, 0, size.width * 0.25, size.height);
    

}



@end
